import { request } from '@umijs/max';

export async function getDevelopInfo() {
  return request('/merchant/open-app/show-develop-settings', {
    method: 'get',
  });
}

export async function viewAPI(params: { token: any }) {
  return request('/merchant/open-app/get-develop-settings', {
    method: 'post',
    data: params,
    getResponse: true,
  });
}
// 获取开发设置验证码

export async function getDevelopPhoneCode() {
  return request('/common/check-code/get-develop-settings', {
    method: 'get',
    getResponse: true,
  });
}

// 获取接口加签数据
export async function getDevelopSettingsToken(params: { checkCode: string }) {
  return request('/merchant/open-app/get-develop-settings-token', {
    method: 'post',
    data: params,
    getResponse: true,
  });
}
// 修改公钥
export async function modifyAppKey(params: {
  appPublicKey: string;
  token: string;
}) {
  return request('/merchant/open-app/update-app-public-key', {
    method: 'post',
    data: params,
    getResponse: true,
  });
}
// 更新IP白名单
export async function modifyWhiteIP(params: {
  whiteIps: string;
  token: string;
}) {
  return request('/merchant/open-app/update—white-ips', {
    method: 'post',
    data: params,
    getResponse: true,
  });
}

// 修改密码获取验证码
export async function getCodeForUpdatePWD(params?: { mobile?: string }) {
  return request('/common/check-code/modify-password', {
    method: 'get',
    getResponse: true,
    params,
  });
}
// 修改支付密码获取验证码
export async function getCodeForUpdatePayPWD(params?: { mobile?: string }) {
  return request('/common/check-code/modify-pay-password', {
    method: 'get',
    getResponse: true,
    params,
  });
}

// 修改密码
export async function modifyPWD(params: {
  checkCode: string;
  password: string;
  repeatPassword: string;
}) {
  return request('/common/user/modify-password', {
    method: 'put',
    getResponse: true,
    data: params,
  });
}
// 修改支付密码

export async function modifyPayPWD(params: {
  checkCode: string;
  password: string;
  repeatPassword: string;
}) {
  return request('/base/user-account/modify-pay-password', {
    method: 'put',
    getResponse: true,
    data: params,
  });
}

// 企业认证获取信息
export async function getCompanyInfo(params: { id: any }) {
  return request(`/merchant/safe-pay-book-account/get-info?id=${params.id}`, {
    method: 'post',
  });
}

export async function submitAuthentication(params: any) {
  return request(
    '/merchant/safe-pay-book-account/submit-business-authentication',
    {
      method: 'post',
      data: params,
      getResponse: true,
    },
  );
}

// 登陆日志
export async function getLoginTravel(params: {
  pageNo: number | string;
  pageSize: number | string;
}) {
  return request('/base/user-account/login-page-search', {
    method: 'post',
    data: params,
    getResponse: true,
  });
}

// 修改企业信息认证
export async function updateCompanyInfo(params: { id: any }) {
  return request('/merchant/safe-pay-book-account/update-info', {
    method: 'post',
    params,
    getResponse: true,
  });
}

export async function openApp() {
  return request('/merchant/open-app/open', {
    method: 'post',
    getResponse: true,
  });
}

export async function unSignAccount(params: { id: any }) {
  return request('/merchant/safe-pay/unsign', {
    method: 'post',
    params,
    getResponse: true,
  });
}
